<!DOCTYPE html>
<html>
<head>
    <include file="Public/head" />
    <link rel="stylesheet" href="__PUBLIC__/Manage/css/table.css">
    <title>商品列表</title>
</head>
<body>
<div class="nestable">
    <div class="console-title console-title-border drds-detail-title clearfix">
        <h5>商品列表</h5>
    </div>
    <div class="public-btnArea">
        <a href="{:U('Product/edit')}" class="btn btn-grayBg">
            <i class="glyphicon glyphicon-plus public-ico"></i>
            <span class="public-label">添加商品</span>
        </a>
    </div>
    <div class="scroll-bar-table">
        <table class="table table-hover">
            <thead>
            <tr>
                <th>序号</th>
                <th>名称</th>
                <th>简介</th>
                <th>Wechat地址</th>
                <th>Alipay地址</th>
                <th>价格</th>
                <th>添加时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <volist name="list" id="vo">
                <tr id="list-{$vo.id}">
                    <td>{$vo.id}</td>
                    <td>{$vo.name}</td>
                    <td>{$vo.content}</td>
                    <td>{$vo.wechat_url}</td>
                    <td>{$vo.alipay_url}</td>
                    <td>{$vo.price}</td>
                    <td>{$vo.addtime|date="Y-m-d H:i:s",###}</td>
                    <td class="text-left">
                        <a href="{:U('Product/edit',array('id'=>$vo['id']))}">编辑</a>
                        <a href="javascript:delAdmin('{$vo.id}','{$vo.name}');">删除</a>
                    </td>
                </tr>
            </volist>
            </tbody>
        </table>
    </div>
    <div class="table-pagin-container">
        <div class="pull-right page-box">
            {$page}
        </div>
    </div>
</div>
</body>
<script>
    function delAdmin(id,name){
        layer.confirm(
            '确定要删除商品:'+name+'吗？',
            {
                btn: ['确认删除','取消']
            },function(){
                cvphp.post(
                    "{:U('Product/delete')}",
                    {
                        id:id
                    },
                    function(data){
                        if(data.status!=1){
                            layer.msg(data.info);
                        }else{
                            $("#list-"+id).remove();
                            layer.msg("操作成功");
                        }
                    }
                );
            }
        );
    }
</script>
</html>